import mysql.connector

# 数据库配置
DB_CONFIG = {
    'host': 'localhost',
    'user': 'root',
    'password': '040908',
    'database': 'wearable_data'
}

def check_table_structure():
    try:
        # 连接数据库
        conn = mysql.connector.connect(**DB_CONFIG)
        cursor = conn.cursor()
        
        # 获取表结构
        cursor.execute("DESCRIBE wearable_data")
        columns = cursor.fetchall()
        
        print("表结构：")
        print("字段名\t\t类型\t\t是否可空\t键\t默认值\t额外信息")
        print("-" * 80)
        for column in columns:
            print("\t".join(str(item) for item in column))
            
    except mysql.connector.Error as err:
        print(f"错误: {err}")
    finally:
        if 'cursor' in locals():
            cursor.close()
        if 'conn' in locals():
            conn.close()

if __name__ == "__main__":
    check_table_structure() 